﻿using System;
using Me.Amon.Util;

namespace Me.Amon.POS
{
    public partial class POS : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            var user = WebUtil.CurrentUser(Session);
            if (user.Rank < IUser.LEVEL_01)
            {
                LlUser.Visible = false;
                LbUser.Visible = false;

                HlUser.Text = "登录";
                HlUser.ToolTip = "用户登录";
                HlUser.NavigateUrl = "~/User/SignIn.aspx";
                return;
            }

            LlUser.Visible = true;
            LbUser.Visible = true;

            HlUser.Text = user.Name;
            HlUser.ToolTip = "我的首页";
            HlUser.NavigateUrl = "~/User/Index.aspx";
        }

        protected void LbSignOf_Click(object sender, EventArgs e)
        {
            WebUtil.CurrentUser(Session).WpSignOf();
            LlUser.Visible = false;
            LbUser.Visible = false;

            HlUser.Visible = true;

            Response.Redirect(IEnv.HOME_PAGE);
        }
    }
}